namespace AltNetUK.Models
{
    using System;
    using System.Globalization;
    using System.Xml.Serialization;

    [XmlRoot(ElementName = "name")]
    public sealed class Name
    {
        public static implicit operator string(Name name)
        {
            return (null == name) ? null as string : name.ToString();
        }

        [XmlAttribute(AttributeName = "given")]
        public string Given
        {
            get;
            set;
        }

        [XmlAttribute(AttributeName = "family")]
        public string Family
        {
            get;
            set;
        }

        public override string ToString()
        {
            return string.Format(CultureInfo.InvariantCulture, "{0} {1}", this.Given, this.Family);
        }
    }
}